//
//  UIView+KK_Ex.m
//  01-工具类
//
//  Created by KK on 16/4/3.
//  Copyright © 2016年 itheima. All rights reserved.
//

#import "UIView+KK_Ex.h"

@implementation UIView (KK_Ex)

- (void)setY:(CGFloat)y {
    
    // 修改控件的y值
    
    // 1.获取控件的frame
    CGRect rect = self.frame;
    
    // 2.修改frame的y
    rect.origin.y = y;
    
    // 3.修改后赋值给控件
    self.frame = rect;
    
}

- (CGFloat)y {

    return self.frame.origin.y;
}

- (void)setX:(CGFloat)x {
    
    CGRect frame = self.frame;
    
    frame.origin.x = x;
    
    self.frame = frame;
    
}


- (CGFloat)x {
    
    return self.frame.origin.x;
}


- (void)setWidth:(CGFloat)width {
    
    CGRect frame = self.frame;
    
    frame.size.width = width;
    
    self.frame = frame;
    
}


- (CGFloat)width {
    
    return self.frame.size.width;
}


- (void)setHeight:(CGFloat)height {
    
    CGRect frame = self.frame;
    
    frame.size.height = height;
    
    self.frame = frame;
    
}


- (CGFloat)height {
    
    return self.frame.size.height;
}



@end
